<script setup name="Person">
// 响应式变量
import {onUpdated, ref} from "vue"

let username = ref("张三")
let somebody = ref({
    username: "张三",
    age:18
})


const onUpdateUsername = () =>{
    username.value = "李四"
}

const onUpdateAge =() =>{
    somebody.value.age++;
}

</script>

<template>
    <h3>用户名为：{{username}}</h3>
    <div>
        <button @click="onUpdateUsername">点击修改用户名为：李四</button>
    </div>
    <h3>{{somebody.username}}的年龄为：{{somebody.age}}</h3>
    <div>
        <button @click="onUpdateAge">点击年龄+1</button>
    </div>
</template>

<style scoped>
    
</style>